#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
    pid_t pid = fork();
    if(pid < 0)
    {
        perror("fork()");
    }
    else if(pid == 0)
    {
        printf("i am a child\n");
        while(1)
        {
            sleep(1);
        }
    }
    else 
    {
        printf("i am a father\n");
        wait(NULL);
    }
    return 0;
}
